{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 1,
   "metadata": {},
   "outputs": [],
   "source": [
    "from geoscilabs.em.ResponseFct import interactive_responseFct\n",
    "from IPython.display import display\n",
    "%matplotlib inline"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# Computing Apparent Resistivity\n",
    "\n",
    "In this app, we compute apparent resistivity using the response curves for a two-loop Frequency domain system for a two-layer earth. Below figure shows horizontal coplanar (HCP) configuration. \n",
    "\n",
    "<img src=\"https://github.com/geoscixyz/geosci-labs/blob/master/images/em/ResponseFct/ResponseFct.png?raw=true\"> </img>\n",
    "\n",
    "Assuming the coil spacing $s \\ll \\delta$, where $\\delta$ is the skin depth, the apparent conductivity is given by\n",
    "\n",
    "$$\n",
    "\\sigma_a = \\int_0^\\infty \\phi(z) \\sigma(z) dz\n",
    "$$\n",
    "\n",
    "Where \n",
    " - $\\sigma_a$ is the apparent conductivity\n",
    " - $\\phi$ is the response function\n",
    " - $\\sigma$ is the conductivity structure\n",
    "\n",
    "Note that in the following plots, the y-axis is a normalized depth: $z/s$ where $s$ is the source-receiver separation.  "
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "Two different configurations of source-receiver configurations are considered:\n",
    "\n",
    "- HCP: Horizontal coplanar system. The associated dipoles are perpendicular to the plane of the loops and are therefore in the vertical direction. The response function associated with this is .\n",
    "\n",
    "- VCP: Vertical coplanar system. The associated dipoles are perpendicular to the plane of the loops and are therefore in the horizontal direction. The response function associated with this is .\n",
    "\n",
    "For more, see the <a href=\"http://gpg.geosci.xyz/en/latest/content/electromagnetics/dual_loop_systems.html\">GPG section on dual loop systems</a>"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Parameters:\n",
    "\n",
    "- h$_{boom}$: height of the source-receiver boom from the surface [m]\n",
    "\n",
    "- h$_{1}$: thickness of the first layer [m]\n",
    "\n",
    "- $\\sigma_{1}$: conductivity of the first layer [S/m]\n",
    "\n",
    "- $\\sigma_{2}$: conductivity of the second layer [S/m]\n",
    "\n",
    "- configuration: configuration of the source-receiver"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "application/vnd.jupyter.widget-view+json": {
       "model_id": "a30e756bc7ed419f9e202754f341dd72",
       "version_major": 2,
       "version_minor": 0
      },
      "text/plain": [
       "interactive(children=(FloatSlider(value=0.0, continuous_update=False, description='$h_{boom}$', max=2.0), Floa…"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "app = interactive_responseFct()\n",
    "display(app)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.6.6"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 1
}
